<template>
  <!-- 搜索框商品搜索展示 -->
  <div>
    <!-- 下拉选项 -->
    <van-dropdown-menu>
      <van-dropdown-item
        disabled
        v-model="value1"
        :options="option1"
        title="综合"
      />
      <van-dropdown-item
        v-model="value1"
        :options="option1"
        title="价格"
        @change="priceArrange"
      />
      <van-dropdown-item v-model="value2" :options="option2" title="分类" />
    </van-dropdown-menu>
    <!-- 商品列表 -->
    <ul class="goods_list">
      <li v-for="e in goodsListData" :key="e.id">
        <img :src="e.list_pic_url" alt="" />
        <div class="van-ellipsis">{{ e.name }}</div>
        <p>{{ e.retail_price | RMB }}</p>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value1: 0,
      value2: "a",
      option1: [
        { text: "价格由高到低", value: 0 },
        { text: "价格由低到高", value: 1 },
      ],
      option2: [
        { text: "全部", value: "a" },
        { text: "居家", value: "b" },
      ],
    };
  },
  methods: {
    priceArrange() {
      console.log(this.goodsListData[1].retail_price);
    },
  },
  props: ["goodsListData"],
};
</script>
 
<style lang = "less" scoped>
.goods_list {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 0.1rem;
  li {
    width: 49%;
    background-color: #fff;
    margin-bottom: 0.1rem;
    line-height: 0.3rem;
    text-align: center;
    font-size: 0.14rem;
    img {
      display: block;
      width: 100%;
    }
    p {
      color: darkred;
    }
  }
}
</style>